﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Regin</title>
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <link href="~/Content/context/css/style.css" rel="stylesheet" />
    <script src="~/Scripts/js/jquery.min.js"></script>
    <script src="~/Scripts/js/common.js"></script>
    <!--背景图片自动更换-->
    <script src="~/Scripts/js/supersized.3.2.7.min.js"></script>
    <script src="~/Scripts/js/supersized-init.js"></script>
    <!--表单验证-->
    <script src="~/Scripts/jquery.validate.js"></script>
</head>
<body>
    <div class="register-container">
        <h1>ShareLink</h1>

        <div class="connect">
            <p>Link the world. Share to world.</p>
        </div>

        <form action="/behavior/regin" method="post" id="registerForm">
            <div>
                <input type="text" name="phone_number" class="phone_number" placeholder="输入手机号码" onblur="check()" autocomplete="off" id="number" />
            </div>
            <div>
                <input type="password" name="password" class="password" placeholder="输入密码" oncontextmenu="return false" onpaste="return false" />
            </div>
            <div>
                <input type="password" name="confirm_password" class="confirm_password" placeholder="再次输入密码" oncontextmenu="return false" onpaste="return false" />
            </div>
            <div>
                <input type="text" name="yzm" placeholder="输入手机验证码" autocomplete="off" onblur="yzmm()" /><input id="Button1" type="button" value="发送手机验证码" style="width:130px;float:right;background-color:#0094ff;" onclick="reques()"/>
            </div>

            <button id="submit" type="submit">注 册</button>
        </form>
        <a href="/Behavior/Login">
            <button type="button" class="register-tis">已经有账号？</button>
        </a>

    </div>
</body>

</html>
<script>
    function check()
    {
        var UserTel = $("[name='phone_number']").val();
        $.ajax({
            url: "/behavior/check",
            dataType: "json",
            data: { UserTel: UserTel },
            type: "post",
            success: function (obj) {
                if (obj == 1) {
                    alert("手机号已存在！");
                    $("[name='phone_number']").val("");
                }
            }
        })
    }
    function reques() {
        var mobiles = $("[name='phone_number']").val();
        $.ajax({
            url: "/behavior/request",
            dataType: "json",
            data: { mobiles: mobiles },
            type: "post",
            success: function (obj) {
                if (obj != 2) {
                    alert("验证码发生错误！");
                }
            }
        })
    }
    function yzmm()
    {
        var yzm = $("[name='yzm']").val();
        $.ajax({
            url: "/behavior/yzm",
            dataType: "json",
            data: { yzm: yzm },
            type: "post",
            success: function (obj) {
                if (obj != 1) {
                    $("[name='yzm']").val("");
                    alert("验证码错误！");
                }
            }
        })
    }
</script>
